-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Improve spaced repetition interface #15627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
app/src/card/newCardTab.ts
Outdated
| }); | ||
| async update() { | ||
| const cardsData = await fetchCardsData(); | ||
| await renderCardsAndBindEvents(this.element, this.data, cardsData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
源代码中没有以下代码,但是调用的函数里面有,没有影响么?
editor = await bindCardEvent({
app: options.app,
element: this.element,
id: this.data.id,
title: this.data.title,
cardType: this.data.cardType,
cardsData,
});
customObj.editors.push(editor);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该是有问题,等我想想怎么改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不行就分开吧,而且这个函数里面还有个外部的变量。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
基本改完了,等会推上来
|
可以了,现在不会重复添加事件监听器 |
| }); | ||
| async update() { | ||
| const cardsData = await fetchCardsData(); | ||
| await renderCardsAndBindEvents(this.element, this.data, cardsData ,undefined, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不太理解为什么一定要这么重构,可以只改业务么?看上去多了 push
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
之前的 update 方法完全是坏的,修复之后重复的代码太多所以又抽象成一个函数了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renderCardsAndBindEvents 和 fetchCardsData 看上去是一个重构。并且修改了原有代码业务:在原有的 108 行 添加了 customObj.editors.push(editor); 。这个用肉眼看上去并不能修复之前完全坏的 update 方法,可能还会引出更多的问题。
|
可以了,现在会销毁旧的 editor |
|
这个问题的重现步骤是?
|
|
用示例插件: async updateCards(options: ICardData) {
console.log("updateCards:", options);
return options;
}video.webm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the spaced repetition interface by refactoring card components and adding new tab functionality. The changes address issues with flash card consistency when opening in new windows and add the ability to open cards in new tabs.
- Refactored card initialization logic to better handle component state
- Added "Open in New Tab" option to the card interface menu
- Fixed data consistency issues when opening cards in new windows
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/src/card/openCard.ts | Extracted card initialization logic into separate function and added new tab menu option |
| app/src/card/newCardTab.ts | Refactored card tab model to use new initialization pattern and improved update handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| }); | ||
| async update() { | ||
| const cardsData = await fetchCardsData(); | ||
| await renderCardsAndBindEvents(this.element, this.data, cardsData ,undefined, true); |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space before comma in function call.
| await renderCardsAndBindEvents(this.element, this.data, cardsData ,undefined, true); | |
| await renderCardsAndBindEvents(this.element, this.data, cardsData, undefined, true); |
|
@Vanessa219 update 方法 bindCardEvent 会导致重复添加监听器(这是我之前拆分为 initCardComponent 和 bindCardEvent 两个函数的原因) |
|
不添加事件的话会有上面的错误,目前已修复。 |
* Improve spaced repetition interface fix siyuan-note#10331 * Improve spaced repetition interface fix siyuan-note#14149 * Improve spaced repetition interface fix siyuan-note#10331 * Improve spaced repetition interface fix siyuan-note#10331
* commit '779c6ede2855aee91f7f54b0b65b7ce3add40c2c': (121 commits) 🔖 Release v3.3.5 📝 Update changelogs 🚨 🎨 siyuan-note#15627 Improve spaced repetition interface (siyuan-note#15627) 🎨 https://ld246.com/article/1760404351939 🐛 siyuan-note#15998 🎨 Clean code 🎨 siyuan-note#15998 🎨 siyuan-note#15989 30 🎨 Improve fold heading editing siyuan-note#15989 🎨 siyuan-note#15989 28&29 🎨 Improve fold heading editing siyuan-note#15989 🎨 Improve fold heading editing siyuan-note#15989 🎨 Improve fold heading editing siyuan-note#15989 🧑💻 siyuan-note#16083 ⬆️ Upgrade lute ⬆️ Upgrade lute 🎨 siyuan-note#16024 🎨 siyuan-note#16011 ...

openTabupdateCards option is null #10331使用新窗口打开的闪卡与当前正在复习的闪卡不一致 #14149 01在新页签中打开选项 #14149 02